// 文件路径: components/conditional-layout.tsx
"use client"; // 标记为客户端组件

import { usePathname } from "next/navigation";
import { Navbar } from "./navbar";
import { Sidebar } from "./sidebar";

export default function ConditionalLayout({
                                              children,
                                          }: Readonly<{
    children: React.ReactNode;
}>) {
    const pathname = usePathname();

    // 如果是 login 页面，则不渲染 Navbar 和 Sidebar
    if (pathname === "/login") {
        return <>{children}</>;
    }

    return (
        <>
            {/* Navbar 组件 */}
            <Navbar />
            {/* 主内容区域 */}
            <div className="flex flex-1">
                {/* Sidebar 组件 */}
                <Sidebar />
                {children}
            </div>
        </>
    );
}